package GuessNumber;

import java.util.Scanner;

public class guessThePrice {
    public static void main(String[] args) {
        int price = (int)(Math.random() * 100)+1;
        System.out.println("请输入价格（1-100之间）：");
        Scanner sc = new Scanner(System.in);
        while (true) {
            int inputPrice = sc.nextInt();
            if (inputPrice == price) {
                System.out.println("恭喜你猜对了！");
                break;
            } else if (inputPrice > price) {
                System.out.println("价格太高了，请重新输入：");
            } else {
                System.out.println("价格太低了，请重新输入：");
            }
        }
    }
}
